//
//  HomeView.swift
//  MobileXGlobal
//
//  Created by ROBIN.J.Y.ZHONG on 2023/5/25.
//

import UIKit

class HomeView: BaseViewController, HomeViewProtocol {
    var presenter: HomePresenterProtocol?
    
    override func viewDidLoad() {
        super.viewDidLoad()
        title = "首页"
        
        setupViews()
    }
    
    func setupViews(){
        let button = UIButton(type: .custom)
        button.setTitle("跳转目标页面", for: .normal)
        button.backgroundColor = .systemBlue
        button.layer.cornerRadius = 5
        button.clipsToBounds = true
        button.addTarget(self, action: #selector(didButtonClick(_:)), for: .touchUpInside)
        view.addSubview(button)
        button.snp.makeConstraints { make in
            make.center.equalToSuperview()
        }
        button.titleLabel?.snp.makeConstraints { make in
            make.left.top.equalToSuperview().offset(10)
            make.right.bottom.equalToSuperview().offset(-10)
        }
    }
    
    @objc func didButtonClick(_ sender: UIButton) {
        // 创建目标页面
        let destinationVC: DestinationViewProtocol & UIViewController = DestinationWireFrame.createDestinationModule()
        // 携带参数
        destinationVC.info = "hello"
        // 跳转到目标页面
        navigationController?.pushViewController(destinationVC, animated: true)
    }
}
